function i = iCOVmn(m,n,M)
assert(m<M && m>=0 && n<M && n>=0);
assert(m<=n);
i = (2*M-m+1)*m/2+(n-m);